package cn.tedu._07springaop.aop;

import org.springframework.stereotype.Component;

@Component
public class CalculatorImpl implements Calculator {
    @Override
    public int add(int a, int b) {
//        if(a>0){
//            throw new IllegalArgumentException("a不能大于0");
//        }

        System.out.println("add方法开始");
        int result = a + b;
        System.out.println("add方法结束");
        return result;
    }

    @Override
    public int sub(int a, int b) {
        System.out.println("sub方法开始");
        int result = a - b;
        System.out.println("sub方法结束");
        return result;
    }

    @Override
    public int mul(int a, int b) {
        System.out.println("mul方法开始");
        int result = a * b;
        System.out.println("mul方法结束");
        return result;
    }

    @Override
    public int div(int a, int b) {
        System.out.println("div方法开始");
        int result = a / b;
        System.out.println("div方法结束");
        return result;
    }
}
